import java.io.DataOutput;
import java.io.IOException;
import java.util.Hashtable;

public class l extends q {

    public Object a;

    public l() {
    }

    public l(byte abyte0[]) {
        a = abyte0;
    }

    public l(q aq[]) {
        a = aq;
    }

    public l(String s) {
        a = s;
    }

    public int a() {
        if (a instanceof String)
            return 4;
        return !(a instanceof byte[]) ? 5 : 7;
    }

    public final boolean c() {
        return a instanceof String;
    }

    public final boolean d() {
        return b() > 0;
    }

    public final int e() {
        if (a() == 4)
            return ce.e((String) a);
        else
            return 0;
    }

    public final long f() {
        if (a() == 4) {
            try {
                return Long.parseLong((String) a);
            } catch (NumberFormatException e1) {
                return 0L;
            }
        }
        return 0L;
    }

    public String toString() {
        if (a() == 5) {
            StringBuffer stringbuffer = new StringBuffer(80);
            q aq[];
            int i = (aq = (q[]) (q[]) a).length;
            stringbuffer.append('(');
            for (int j = 0; j < i; j++) {
                if (j > 0) {
                    stringbuffer.append(',');
                    stringbuffer.append(' ');
                }
                stringbuffer.append(aq[j]);
            }

            stringbuffer.append(')');
            return stringbuffer.toString();
        } else {
            return String.valueOf(a);
        }
    }

    public final byte[] g() {
        if (a instanceof byte[])
            return (byte[]) (byte[]) a;
        else
            return null;
    }

    public int b() {
        switch (a()) {
            case 4: // '\004'
                return ((String) a).length();

            case 7: // '\007'
                return ((byte[]) (byte[]) a).length;

            case 5: // '\005'
                return ((q[]) (q[]) a).length;

            case 6: // '\006'
            default:
                return 0;
        }
    }

    public final int a(String s) {
        if (a() != 5)
            return -1;
        q aq[];
        int i = (aq = (q[]) (q[]) a).length;
        for (int j = 0; j < i; j++) {
            q q1;
            q q2;
            if ((q1 = aq[j]).a() == 6 && (q2 = q1.a(0)).a() == 4 && q2.toString().equals(s))
                return j;
        }

        return -1;
    }

    public final int a(q q1) {
        if (a() != 5)
            return -1;
        q aq[];
        int i = (aq = (q[]) (q[]) a).length;
        for (int j = 0; j < i; j++) {
            q q2;
            if ((q2 = aq[j]).a() == 6 && q2.a(0).equals(q1))
                return j;
        }

        return -1;
    }

    public final q b(String s) {
        int i;
        if ((i = a(s)) >= 0)
            return ((q[]) (q[]) a)[i].a(1);
        else
            return q.c;
    }

    public final q b(q q1) {
        int i;
        if ((i = a(q1)) >= 0)
            return ((q[]) (q[]) a)[i].a(1);
        else
            return q.c;
    }

    public final q a(int i) {
        int j;
        if ((j = a()) != 5 && j != 6)
            return q.c;
        q aq[] = (q[]) (q[]) a;
        if (i < 0 || i >= aq.length)
            return q.c;
        else
            return aq[i];
    }

    public final q c(q q1) {
        if (a() != 5) {
            return this;
        } else {
            q aq[];
            int i;
            q aq1[] = new q[(i = (aq = (q[]) (q[]) a).length) + 1];
            System.arraycopy(aq, 0, aq1, 0, i);
            aq1[i] = q1;
            a = aq1;
            return this;
        }
    }

    public final void a(q q1, q q2) {
        if (a() != 5)
            return;
        int i;
        if ((i = a(q1)) >= 0) {
            ((q[]) (q[]) a)[i] = new a(q1, q2);
            return;
        } else {
            c(new a(q1, q2));
            return;
        }
    }

    public final void a(int i, q q1) {
        q aq1[];
        int j;
        if (a() != 5)
            return;
        q aq[] = (q[]) (q[]) a;
        if (i < 0)
            return;
        if (i < aq.length) {
            aq[i] = q1;
            return;
        }
        aq1 = new q[i + 1];
        j = aq.length;
        System.arraycopy(aq, 0, aq1, 0, j);
        aq1[i--] = q1;
        while (i >= j) {
            aq1[i--] = q.c;
        }
        a = aq1;
    }

    public final q d(q q1) {
        if (a() != 5)
            return this;
        q aq[];
        int i = (aq = (q[]) (q[]) a).length;
        for (int j = 0; j < i; j++)
            if (aq[j] == q1)
                b(j);

        return this;
    }

    public final q b(int i) {
        if (a() != 5)
            return null;
        q q1 = null;
        q aq[] = (q[]) (q[]) a;
        if (0 <= i && i < aq.length) {
            q aq1[] = new q[aq.length - 1];
            q1 = aq[i];
            for (int j = 0; j < i; j++)
                aq1[j] = aq[j];

            for (int k = i + 1; k < aq.length; k++)
                aq1[k - 1] = aq[k];

            a = aq1;
        }
        return q1;
    }

    public int hashCode() {
        int i = 0;
        switch (a()) {
            case 6: // '\006'
            default:
                break;

            case 4: // '\004'
                i = ((String) a).hashCode();
                break;

            case 5: // '\005'
                i = 0;
                q aq[] = (q[]) (q[]) a;
                int j = 0;
                for (int k = aq.length; j < k; j++)
                    i = (i *= 31) ^ aq[j].hashCode();

                break;

            case 7: // '\007'
                i = System.identityHashCode(this);
                break;
        }
        return i;
    }

    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (!(obj instanceof l))
            return false;
        l l1 = (l) obj;
        if (a() != l1.a())
            return false;
        int i;
        switch (a()) {
            case 4: // '\004'
                return a.equals(l1.a);

            case 5: // '\005'
                if ((i = b()) == l1.b()) {
                    for (int j = 0; j < i; j++)
                        if (!a(j).equals(l1.a(j)))
                            return false;

                    return true;
                } else {
                    return false;
                }

            case 6: // '\006'
            case 7: // '\007'
            default:
                return false;
        }
    }

    public final q a(boolean flag) {
        switch (a()) {
            case 5: // '\005'
                q aq[];
                int i;
                q aq1[] = new q[i = (aq = (q[]) (q[]) a).length];
                for (int k = 0; k < i; k++)
                    aq1[k] = flag ? aq[k].a(flag) : aq[k];

                return new l(aq1);

            case 7: // '\007'
                byte abyte0[];
                int j;
                byte abyte1[] = new byte[j = (abyte0 = (byte[]) (byte[]) a).length];
                System.arraycopy(abyte0, 0, abyte1, 0, j);
                return new l(abyte1);
        }
        return this;
    }

    public final void a(DataOutput dataoutput, Hashtable hashtable) throws IOException {
        switch (a()) {
            default:
                break;

            case 4: // '\004'
                String s;
                int i;
                if ((i = (s = (String) a).length()) == 0) {
                    dataoutput.writeByte(122);
                    return;
                }
                if (q.a(dataoutput, hashtable, s))
                    return;
                if (i <= 255) {
                    dataoutput.writeByte(115);
                    c.a(dataoutput, s);
                } else if (i <= 65535) {
                    dataoutput.writeByte(83);
                    c.b(dataoutput, s);
                } else {
                    dataoutput.writeByte(67);
                    c.c(dataoutput, s);
                    return;
                }
                break;

            case 7: // '\007'
                dataoutput.writeByte(66);
                byte abyte0[] = (byte[]) (byte[]) a;
                dataoutput.writeInt(abyte0.length);
                dataoutput.write(abyte0, 0, abyte0.length);
                return;

            case 6: // '\006'
                dataoutput.writeByte(112);
                a(0).a(dataoutput, hashtable);
                a(1).a(dataoutput, hashtable);
                return;

            case 5: // '\005'
                q aq[];
                int j;
                if ((j = (aq = (q[]) (q[]) a).length) == 0) {
                    dataoutput.writeByte(79);
                    return;
                }
                if (j <= 255) {
                    dataoutput.writeByte(40);
                    dataoutput.writeByte(j);
                } else if (j <= 65535) {
                    dataoutput.writeByte(91);
                    dataoutput.writeShort(j);
                } else {
                    dataoutput.writeByte(123);
                    dataoutput.writeInt(j);
                }
                for (int k = 0; k < j; k++)
                    aq[k].a(dataoutput, hashtable);

                break;
        }
    }
}